﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using _7DaysToDieTools.Class;

namespace _7DaysToDieTools
{
    public partial class FormLangAdd : Form
    {
        public LangItem TheAddItem = null;
        public FormLangAdd()
        {
            InitializeComponent();
        }
        public FormLangAdd(Form pForm)
        {
            InitializeComponent();
            this.Location = new Point(pForm.Location.X + pForm.Width / 2 - this.Width / 2, pForm.Location.Y + pForm.Height / 2 - this.Height / 2);
        }

        private void FormLangAdd_Load(object sender, EventArgs e)
        {

        }

        private void buttOK_Click(object sender, EventArgs e)
        {
            //检测
            if (string.IsNullOrWhiteSpace(tboxEName.Text))
            {
                MessageBox.Show("请输入项的名称！");
                return;
            }
            //构建返回对象
            TheAddItem = new LangItem();
            TheAddItem.Key = tboxEName.Text;
            TheAddItem.Source = tboxESource.Text;
            TheAddItem.Context = tboxEContext.Text;
            TheAddItem.Changes = tboxEChanges.Text;
            TheAddItem.English = tboxEEnglish.Text;
            TheAddItem.French = tboxEFrench.Text;
            TheAddItem.German = tboxEGerman.Text;
            TheAddItem.Klingon = tboxEKlingon.Text;
            TheAddItem.Spanish = tboxESpanish.Text;
            //返回
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void buttCancel_Click(object sender, EventArgs e)
        {
            TheAddItem = null;
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
